<template>
	<view class="container">
		<view class="carousel">
			<swiper indicator-dots circular=true duration="400">
				<swiper-item class="swiper-item" v-for="(item,index) in imgList" :key="index">
					<view class="image-wrapper">
						<image :src="item.src" class="loaded" mode="aspectFill"></image>
					</view>
				</swiper-item>
			</swiper>
		</view>
		<view class="introduce-section">
			<text class="title">脑白金 脑白金胶囊+口服液(附礼盒袋) 0.25g*20粒+250ml*2瓶</text>
			<view class="price-box">
				<text class="price-tip">¥</text>
				<text class="price">256.00</text>
				<text class="m-price">¥306.00</text>
				<text class="coupon-tip">立省50元</text>
			</view>
			<view class="bot-row">
				<text>销量: 108</text>
				<text>库存: 4690</text>
				<text>浏览量: 768</text>
			</view>
			<view class="padding margin-top" :class="size?'solids-top':'solid-top'">
				<view>
					<text style="color: #007AFF;">【全民抗疫，守护健康】低至258元，本品改善睡眠，润肠通便，满2件送维生素C咀嚼片（补维生素C），满4件送汤臣倍健 蛋白粉（增强免疫）！</text>
				</view>
				<view>
					<text style="color: #B5B5B5;">厂家：无锡健特药业有限公司</text>
				</view>
			</view>
			<view>
				<image src="http://res.360kad.com/theme/default/img/ydcp/ykt_01.jpg" style="width: 100%;height: 200upx;"></image>
				<image src="http://image.360kad.com/group2/M00/A4/43/CgAgFVxCzwSAMO97AAImbSVhhvM494.jpg" style="width: 100%;"></image>
				<image src="http://image.360kad.com/group2/M00/A4/43/CgAgFFxCzwWAR8y0AAAw-R7ZTvU304.jpg" style="width: 100%;height: 100upx"></image>
				<image src="http://image.360kad.com/group2/M00/A4/43/CgAgFVxCzwWAASeXAAGrLm_3loM655.jpg" style="width: 100%;height: 900upx"></image>
				<image src="http://image.360kad.com/group2/M00/A4/43/CgAgFFxCzwWAKY1WAAEubXzx-6k470.jpg" style="width: 100%;"></image>
				<image src="http://image.360kad.com/group2/M00/A4/43/CgAgFVxCzwWAczTwAAES8q1crow980.jpg" style="width: 100%;"></image>
				<image src="http://image.360kad.com/group2/M00/A4/43/CgAgFFxCzwWAI5FXAAIp0Z-Ck4w013.jpg" style="width: 100%;"></image>
			</view>
		</view>
		<!-- 底部操作菜单 -->
		<view class="page-bottom">
			<navigator url="/pages/tabbar/tabbar-1/tabbar-1" open-type="switchTab" class="p-b-btn">
				<text class="yticon icon-xiatubiao--copy"></text>
				<text>首页</text>
			</navigator>
			<navigator url="/pages/tabbar/tabbar-4/tabbar-4" open-type="switchTab" class="p-b-btn">
				<text class="yticon icon-gouwuche"></text>
				<text>购物车</text>
			</navigator>
			<view class="p-b-btn" :class="{active: favorite}" @click="toFavorite">
				<text class="yticon icon-shoucang"></text>
				<text>收藏</text>
			</view>

			<view class="action-btn-group">
				<button type="primary" class=" action-btn no-border buy-now-btn" @click="buy">立即购买</button>
				<button type="primary" class=" action-btn no-border add-cart-btn">加入购物车</button>
			</view>
		</view>


	</view>

</template>

<script>
	export default {
		data() {
			return {
				favorite: true,
				size: false,
				dotStyle: false,
				imgList: [{
						src: 'http://image.360kad.com/group1/M00/64/0E/CgAgEVf4QviAVywgAAGlW8Bd-Fg152.jpg'
					},
					{
						src: 'http://image.360kad.com/group1/M00/64/0E/CgAgEVf4QviAXDB1AAGc5JgZsn4777.jpg'
					},
					{
						src: 'http://image.360kad.com/group1/M00/64/0E/CgAgEFf4QviAOBqLAAFkdm-d9vA756.jpg'
					}
				],
			}
		},
		onLoad() {},
		methods: {
			SetSize(e) {
				this.size = e.detail.value
			},
			//收藏
			toFavorite() {
				this.favorite = !this.favorite;
			},
			buy() {
				uni.navigateTo({
					url: `/pages/order/createOrder`
				})
			},
		},
	}
</script>

<style lang="scss">
	.carousel {
		height: 722upx;
		position: relative;

		swiper {
			height: 100%;
		}

		.image-wrapper {
			width: 100%;
			height: 100%;
		}

		.swiper-item {
			display: flex;
			justify-content: center;
			align-content: center;
			height: 750upx;
			overflow: hidden;

			image {
				width: 100%;
				height: 100%;
			}
		}

	}

	/* 标题简介 */
	.introduce-section {
		background: #fff;
		padding: 20upx 30upx;

		.title {
			font-size: 32upx;
			color: $font-color-dark;
			height: 50upx;
			line-height: 50upx;
		}

		.price-box {
			display: flex;
			align-items: baseline;
			height: 64upx;
			padding: 10upx 0;
			font-size: 26upx;
			color: $uni-color-primary;
		}

		.price {
			font-size: $font-lg + 2upx;
		}

		.m-price {
			margin: 0 12upx;
			color: $font-color-light;
			text-decoration: line-through;
		}

		.coupon-tip {
			align-items: center;
			padding: 4upx 10upx;
			background: $uni-color-primary;
			font-size: $font-sm;
			color: #fff;
			border-radius: 6upx;
			line-height: 1;
			transform: translateY(-4upx);
		}

		.bot-row {
			display: flex;
			align-items: center;
			height: 50upx;
			font-size: $font-sm;
			color: $font-color-light;

			text {
				flex: 1;
			}
		}
	}

	/* 底部操作菜单 */
	.page-bottom {
		position: fixed;
		left: 30upx;
		bottom: 30upx;
		z-index: 95;
		display: flex;
		justify-content: center;
		align-items: center;
		width: 690upx;
		height: 100upx;
		background: rgba(255, 255, 255, .9);
		box-shadow: 0 0 20upx 0 rgba(0, 0, 0, .5);
		border-radius: 16upx;

		.p-b-btn {
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
			font-size: $font-sm;
			color: $font-color-base;
			width: 96upx;
			height: 80upx;

			.yticon {
				font-size: 40upx;
				line-height: 48upx;
				color: $font-color-light;
			}

			&.active,
			&.active .yticon {
				color: $uni-color-primary;
			}

			.icon-fenxiang2 {
				font-size: 42upx;
				transform: translateY(-2upx);
			}

			.icon-shoucang {
				font-size: 46upx;
			}
		}

		.action-btn-group {
			display: flex;
			height: 76upx;
			border-radius: 100px;
			overflow: hidden;
			box-shadow: 0 20upx 40upx -16upx #fa436a;
			box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
			background: linear-gradient(to right, #ffac30, #fa436a, #F56C6C);
			margin-left: 20upx;
			position: relative;

			&:after {
				content: '';
				position: absolute;
				top: 50%;
				right: 50%;
				transform: translateY(-50%);
				height: 28upx;
				width: 0;
				border-right: 1px solid rgba(255, 255, 255, .5);
			}

			.action-btn {
				display: flex;
				align-items: center;
				justify-content: center;
				width: 180upx;
				height: 100%;
				font-size: $font-base;
				padding: 0;
				border-radius: 0;
				background: transparent;
			}
		}
	}
</style>
